package com.bayihouse.model.vo;


import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.bayihouse.model.entity.Announcement;
import com.bayihouse.utils.MyDateUtils;
import lombok.*;
import org.python.antlr.ast.Str;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode
public class AnnouncementVO implements Serializable {


    private static final long serialVersionUID = 3077474984114720465L;


    /**
     * 公告Id
     */
    private Long id;


    /**
     * 创建时间
     */
    private String createtime;

    /**
     * 上传者Id
     */
    private String administerName;

    /**
     * 作者名字
     */
    private String authername;

    /**
     * 公告题目
     */
    private String title;


    /**
     * 每个公告都有自己的图片
     */
    private String headimageUrl;

    public static AnnouncementVO objToVo(Announcement anncouncement) {
        AnnouncementVO announcementVO = new AnnouncementVO();
        BeanUtils.copyProperties(anncouncement, announcementVO);
        announcementVO.setCreatetime(MyDateUtils.dateToString(anncouncement.getCreatetime()));
        return announcementVO;
    }
}
